//
//  APIManager.h
//  Rockval
//
//  Created by TuanNT on 4/27/14.
//  Copyright (c) 2014 TNL. All rights reserved.
//

#import "AFHTTPRequestOperationManager.h"

#import "ObLoginRequest.h"
#import "ObLoginResponse.h"
#import "ObSignUpRequest.h"
#import "ObSignUpResponse.h"
#import "PrimaryRole.h"
#import "state.h"
#import "ObProfileUpdateRequest.h"
#import "ObProfileResponse.h"
#import "ObMapListingRequest.h"
#import "ObMapListingResponse.h"
#import "ObListingDetailResponse.h"
#import "ObActionRequest.h"
#import "ObWatchingListRequest.h"

typedef enum {
	APISingin  = 1,
	APIPrimaryRole,
	APISignUp,
	APICountry,
	APIState,
	APIProfile,
	APIMapListing,
	APIListingSearch,
	APIListingDetail,
	APIRecentActivity,
	APIAddWatchList,
	APIDeleteWatchList,
	APIWatchingSale,
	APIWatchingLease,
}APIType;

@interface APIManager : AFHTTPRequestOperationManager

/**
 * gets singleton object.
 * @return singleton
 */
+ (APIManager *)sharedInstance;
- (void)loginWithObject:(ObLoginRequest *)obj andBlock:(void (^)(BOOL isSucsess, NSError *error))block;
- (void)listCountryWithBlock:(void (^)(NSArray *countries))block;

- (void)loginWithEmail:(NSString *)email
              password:(NSString *)password
              andBlock:(void (^)(BOOL isSuccess, NSDictionary *accountDict))block;

/* Watching list */
- (void)watchingListForSaleWithCustomerId:(NSString *)customerId
                                 andBlock:(void (^)(NSArray *list))block;

- (void)watchingListForLeaseWithCustomerId:(NSString *)customerId
                                  andBlock:(void (^)(NSArray *list))block;

- (void)addToWatchingListForItem:(NSString *)itemId
                      customerId:(NSString *)customerId
                        andBlock:(void (^)(BOOL result))block;

- (void)removeFromWatchingListForItem:(NSString *)itemId
                           customerId:(NSString *)customerId
                             andBlock:(void (^)(BOOL result))block;

/* Recent activity */
- (void)recentActivityForCustomerWithId:(NSString *)customerId
                                  block:(void (^)(NSArray *list))block;
- (void)signUpWithObject:(ObSignUpRequest *)obj andBlock:(void (^)(BOOL isSucsess, NSError *error))block;

- (void)saleNearByWithLatitute:(NSString *)lat
                    longtitute:(NSString *)longt
                      andBlock:(void (^)(NSArray *list))block;

- (void)leaseNearByWithLatitute:(NSString *)lat
                     longtitute:(NSString *)longt
                       andBlock:(void (^)(NSArray *list))block;

/* Filter */
- (void)filterByType:(NSString *)type
             keyword:(NSString *)keyword
            priceMin:(NSString *)priceMin
            priceMax:(NSString *)priceMax
             yearMin:(NSString *)yearMin
             yearMax:(NSString *)yearMax
             country:(NSString *)country
               state:(NSString *)state
                city:(NSString *)city
                 zip:(NSString *)zip
     buildingSizeMin:(NSString *)buildingSizeMin
     buildingSizeMax:(NSString *)buildingSizeMax
          lotSizeMin:(NSString *)lotSizeMin
          lotSizeMax:(NSString *)lotSizeMax
               block:(void (^)(NSArray *list))block;
@end
